package com.hdsx.restful.glzt.roadline.ldss.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.esri.arcgis.geometry.IGeometry;
import com.hdsx.ao.base.BaseOpearte;
import com.hdsx.ao.util.GemotryUtil;
import com.hdsx.restful.glzt.roadline.ldss.bean.Ldss;
import com.hdsx.restful.glzt.roadline.ldss.mapper.LdssMapper;
import com.hdsx.restful.glzt.roadline.ldss.service.LdssService;

@Service
public class LdssServiceImpl extends BaseOpearte<Ldss> implements LdssService {
	public LdssServiceImpl() {
		super("GIS_LDSS");
	}

	@Resource
	private LdssMapper ldssMapper;

	@Override
	public int queryCountByParameter(String lxdm) {
		Map<String,String> map=new HashMap<String, String>();
		map.put("lxdm",lxdm);
		return ldssMapper.queryCountByParameter(map);
	}

	@Override
	public List<Ldss> queryByParameter(String lxdm, int begin, int end) {
		
		Map<String,Object> parameter=new HashMap<String,Object>();
		parameter.put("begin",begin);
		parameter.put("end", end);
		parameter.put("lxdm",lxdm);
		List<Ldss> lists=ldssMapper.queryByParameter(parameter);
		for(Ldss ldss:lists){
			ldss.setShape(selectShape("ID= '"+ldss.getId()+"'"));
		}
		return lists;
	}

	@Override
	public String queryLdssString(String id) {
		IGeometry shape=selectShape("ID= '"+id+"'");
		return GemotryUtil.generateLineString(shape);
	}

}
